package edu.netjava.Triangle;

import java.util.Scanner;

public class DouTriangle {
	
	String Str;
	int SPACE_NUMBER = 12;// define the space of every line
	static int lineNumber;// in order to control the space print
	// draw a triangle
	public void drawDouTriangle(int n) {

		if (n == 0) {
			System.out.println("this is no line to draw");
		} else {
			lineNumber = n;
			for (int i = 0; i < n/2; i++) {
				drawSpace(lineNumber + SPACE_NUMBER);
				drawStar(i);
				System.out.println();
				lineNumber--;
			}
			
			for (int i = n/2; i >0; i--) {
				drawSpaceReverse(lineNumber + SPACE_NUMBER);
				drawStarReverse(i);
				System.out.println();
				lineNumber++;
			}
		}

	}
	
    //draw spaces of the triangle 
	public static void drawSpace(int n) {

		for (int i = 0; i < n-1; i++) {
			System.out.print(" ");
		}
	}
	    //draw star of the triangle
	public static void drawStar(int n) {

		for (int i = 0; i < (2*n - 1); i++) {
			System.out.print("*");
		}
	}
	
	
	public static void drawSpaceReverse(int n) {

		for (int i = n-1; i > 0; i--) {
			System.out.print(" ");
		}
	}
	public static void drawStarReverse(int n){
		for (int i = (2*n - 1); i > 0; i--) {
			System.out.print("*");
		}
		
	}
	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);
		System.out.println("please input the number of the star line:");
		int n = sca.nextInt();

		DouTriangle dta = new DouTriangle();
		dta.drawDouTriangle(n);

		byte b = (byte) 256;
		System.out.println(b);
		System.out.print("s");
		System.out.print(" ");
		System.out.print("s");

		System.out.println("kaish");
		System.out.print("sdfs");
	}


}
